import request from './request.js'

export default {
    // 获取学院分页数据
    getAcademyPage(pageNum = 1, pageSize = 10, academyName = '') {
        return request.get('/academy/page', {
            params: {
                pageNum,
                pageSize,
                academyName
            }
        })
    },

    // 获取所有专业列表
    getMajorList() {
        return request.get('/major/selectall')
    },

    // 添加专业到学院
    joinMajorToAcademy(academyId, majorId) {
        return request.post('/academy/majorjoinacademy', null, {
            params: {
                academyId,
                majorId
            }
        })
    },

    // 创建新学院
    createAcademy(academyName) {
        return request.post('/academy/create', {
            academyName: academyName
        })
    },

    // 查询学院的专业列表
    getAcademyMajors(academyId) {
        return request.get('/academy/selectmajor', {
            params: {
                id: academyId
            }
        })
    },

    // 删除学院关联的专业
    deleteAcademyMajor(academyId, majorId) {
        return request.delete('/academy/deletemajor', {
            params: {
                academyId,
                majorId
            }
        })
    },

    // 删除学院
    deleteAcademy(academyId) {
        return request.delete('/academy/delete', {
            params: {
                id: academyId
            }
        })
    }
}